<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class StudentQuestion extends Model
{
    use SoftDeletes;

    protected $table = 'sf_student_question';
    public $timestamps = false;
    protected $guarded = ['_method']; // 黑名单

    const STATUS_NOT_READ = 1;
    const STATUS_READ = 2;

    const VERIFY_UNKNOWN = 0;
    const VERIFY_PASS = 1;
    const VERIFY_NO = 2;

    /**
     * 设置老师ids
     *
     * @param  string  $value
     * @return string
     */
    public function setTeacherIdsAttribute($value)
    {
        $this->attributes['teacher_ids'] = json_encode($value);
    }

    /**
     * 查询老师ids
     *
     * @param  string  $value
     * @return string
     */
    public function getTeacherIdsAttribute($value)
    {
        $this->attributes['teacher_ids'] = json_decode($value, true);
    }

    /**
     * 获取日期
     *
     * @param  string  $value
     * @return string
     */
    public function getCreatedTimeAttribute($value)
    {
        return get_date($value, 'Y-m-d H:i:s');
    }
}
